--[[ 编码: WMS-58-11 名称: 入库波次-查询面板-查询 作者:HAN 日期:2025-02-14 级别:固定 (说明本段代码在项目中不太会变化) 函数: Query 功能: 根据查询面板里的输入,组成SQL的查询条件 更改记录: --]] json = require ("json") mobox = require ("OILua_JavelinExt") m3 = require("oi_base_mobox") function Query ( strLuaDEID ) local nRet, strRetInfo local parameter = {} local attrs local runtime_parameter nRet, runtime_parameter = m3.GetRuntimeParam(strLuaDEID) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "GetRuntimeParam失败! "..runtime_parameter ) end -- 获取功能点里定义的查询条件 local strSQL = lua.Get_StrAttrValue( runtime_parameter.base_condition ) -- 获取查询面板里的输入属性 nRet, attrs = m3.GetSysInputParameter( strLuaDEID ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "m3.GetSysInputParameter 失败! "..attrs ) end parameter = m3.KeyValueAttrsToObjAttr( attrs ) local state = lua.Get_StrAttrValue( parameter.State ) -- 入库波次状态 local station = lua.Get_StrAttrValue( parameter.Station ) -- 站台 -- 生成空满状态查询 local state_condition = '' if ( state == '未组盘') then state_condition = "N_B_STATE = 0 " elseif ( state == '组盘') then state_condition = "N_B_STATE = 1 " elseif ( state == '执行') then state_condition = "N_B_STATE = 2 " elseif ( state == '完成') then state_condition = "N_B_STATE = 3" end -- 生成锁状态查询 local station_condition = '' if ( station ~= '') then sub_condition = "S_STATION_NO = '"..station.."'" end if ( state_condition ~= '' ) then if ( strSQL ~= '' ) then strSQL = strSQL.." AND " end strSQL = strSQL..state_condition end if ( station_condition ~= '' ) then if ( strSQL ~= '' ) then strSQL = strSQL.." AND " end strSQL = strSQL..station_condition end -- 设置查询条件 local action = { { action_type = "set_query_condition", value = { condition = strSQL, order = "S_WAVE_NO" } } } nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str( action ) ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end end